# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Minecrell <minecrell@minecrell.net>
pkgname=device-asus-me176c
pkgdesc="ASUS MeMO Pad 7 (ME176C(X))"
pkgver=2
pkgrel=2
_commit=3155254999ac36c3051a2118c415de25a072c0f6
url="https://postmarketos.org"
license="MIT"
arch="x86_64"
options="!check !archcheck"
depends="
	$pkgname-factory
	alsa-ucm-conf
	firmware-asus-me176c-acpi
	intel-ucode
	linux-asus-me176c
	mesa-dri-classic
	mesa-vulkan-intel
	postmarketos-base
	"
makedepends="devicepkg-dev meson eudev-dev"
source="https://github.com/me176c-dev/linux-me176c/archive/$_commit.tar.gz
	deviceinfo
	"
subpackages="$pkgname-factory $pkgname-nonfree-firmware:nonfree_firmware"
builddir="$srcdir/linux-me176c-$_commit"

build() {
	devicepkg_build $startdir $pkgname

	cd factory
	abuild-meson . output \
		-Dsystemd=false \
		-Dopenrc=true
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

package() {
	devicepkg_package $startdir $pkgname
}

factory() {
	pkgdesc="WiFi/BT MAC address loader"
	depends="bluez-btmgmt"
	cd "$builddir"/factory
	DESTDIR="$subpkgdir" meson install -C output
}

nonfree_firmware() {
	pkgdesc="WiFi, Bluetooth and Sound firmware"
	depends="linux-firmware-intel firmware-asus-me176c"
	mkdir "$subpkgdir"
}

sha512sums="25b18f7d2c6d6570077143b404d821e4814f23ce8e46dfe7c8f0ed7d318b5e8c7fba1bd68a7536cb3b9adb3ca6753e08dd1fa56d1e99bfabbe6992ce9b3575e1  deviceinfo
75243e3d0bc9a352465683ec8cf8b83566e4131bb7fae0f388267a62bdbf4691c955ed034b30df550f921b771080688123ae8db144b72f786bf1677ef1d83f57  3155254999ac36c3051a2118c415de25a072c0f6.tar.gz"
